package cn.edu.scau.cmi.zeyang.factory;

import cn.edu.scau.cmi.zeyang.domain.insurance.Insurance;

public class FactoryController {

	public static Insurance getInsurance(String type){
		InsuranceFactory insuranceFactory;
		switch (type) {
		case "司机受伤":
			insuranceFactory = new BodilyInjuryFactory();
			break;
		case "汽车损坏":
			insuranceFactory = new AutomobileDamageFactory();
			break;
		case "人员伤亡":
			insuranceFactory = new CasualtiesFactory();
			break;
		case "多种事故":
			insuranceFactory = new MultipleAccidentsFactory();
			break;
		default:
			insuranceFactory = null;
		}
		if(insuranceFactory!=null)return insuranceFactory.getInsurance();
		else return null;
	}

}
